package com.sq.partner.manager.dao.impl;


import java.sql.SQLException;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.sq.partner.manager.dao.IGatewayTradProdPlanDao;
import com.sq.partner.manager.mybatis.model.TradPlanBase;
import com.sq.partner.manager.mybatis.model.TradProdPlan;
import com.sq.partner.manager.util.LogUtil;
@Repository
public class GatewayTradProdPlanDaoImpl  extends BaseDaoImpl implements IGatewayTradProdPlanDao {
	private static Logger logger = LogUtil.getLog(GatewayTradProdPlanDaoImpl.class);

	
	@Override
	public TradProdPlan queryTradProdPlan(TradProdPlan tradProdPlan) throws SQLException {
		// TODO Auto-generated method stub
		
		return  (TradProdPlan) this.query("queryTradProdPlanByMap", tradProdPlan);
	}

	@Override
	public void saveTradProdPlan(TradProdPlan tradprodplan) throws Exception {
		this.add("insertTradProdPlan", tradprodplan);
	}

	@Override
	public List<TradProdPlan> queryTradProdPlanList(TradProdPlan tradProdPlan)
			throws SQLException {
		// TODO Auto-generated method stub
		return (List<TradProdPlan>) this.queryList("queryTradProdPlanByMap", tradProdPlan);
	}

	@Override
	public void deleteTradProdPlan(TradProdPlan tradProdPlan) throws Exception {
		// TODO Auto-generated method stub
		this.delete("delTradProdPlan", tradProdPlan);
	}
	
	@Override
	public boolean queryIsExistHealthPlan(TradProdPlan tradProdPlan) throws Exception {
		Integer re = (Integer) this.query("queryExistHealthPlanCountById", tradProdPlan);
		if(re!=null && re.intValue() > 0){
			return true;
		}
		return false;
	}
	
}
